import { get, post, remove, put } from '@/server/request'
import { baseApi, baseApp } from '@/server/base'
import { type LoginUser } from '@/server/index'

/**
 * 用户登录
 */
export function login(params: LoginParams) {
  return post(`${baseApi}/user/login`, params)
}

/**
 * 注册
 */
export function register(params: RegisterParams) {
  return post(`${baseApi}/user/register`, params)
}

/**
 * 获取用户菜单
 * @param params 
 */
export function userMenu(params: { userId: string | number }) {
  return get(`${baseApi}/menu/getMenuByUser/${params.userId}`);
}
/**
 * 修改密码
 * @param params 
 */
export function editPassWord(params:{newPassWord:string,oldPassWord:string}){
  return post(`${baseApi}/user/changePassword`, params)
}

export type LoginParams = {
  username: string
  password: string
}


export interface RegisterParams extends LoginUser {

}
